<template>
    <div class="evection-task">
        <my-breadcrumb :breadcrumb="['我的任务','请假审批']"/>
        <el-table :data="taskData">
            <el-table-column label="请假员工" prop="startUserName"/>
            <el-table-column label="请假原因" prop="cause"/>
            <el-table-column label="开始时间" prop="beginTime"/>
            <el-table-column label="结束时间" prop="endTime"/>
            <el-table-column label="请假天数" prop="days"/>
            <el-table-column label="请假类型" prop="holidayTypeName"/>
            <el-table-column label="操作">
                <template #default="s">
                    <el-button @click="handleLeaveTask(s.row)" plain>处理</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
    <leave-task-handle ref="taskHandleRef" @refresh-data="loadLeaveTask"/>
</template>

<script>
import LeaveTaskHandle from "./LeaveTaskHandle.vue";
import MyBreadcrumb from "../../../../components/MyBreadcrumb.vue";
import {queryMyAuditLeaveTask} from "../../../../network/process/leave-process";

export default {
    name: "LeaveTask",
    components: {LeaveTaskHandle,MyBreadcrumb},
    data(){
        return {
            taskData: []
        }
    },
    methods: {
        handleLeaveTask(row){
            let ref = this.$refs.taskHandleRef;
            ref.visible = true;
            ref.task = row;
            ref.auditResult.taskId = row.taskId;
        },
        loadLeaveTask(){
            let userId = this.$store.state.loginUser.id;
            queryMyAuditLeaveTask(userId).then(vo=>{
                this.$response.handle({
                    data: vo,
                    successFn: ()=>{
                        this.taskData = vo.data;
                    },
                    log: '我的请假审批任务'
                })
            })
        }
    },
    created() {
        this.loadLeaveTask();
    }
}
</script>

<style scoped>
*{
    /*border: 1px solid red;*/
}
.evection-task{
    height: 99%;
    background: white;
}
</style>